package com.hzncc.flowable_diboot.controller;

import com.diboot.core.vo.JsonResult;
import com.hzncc.flowable_diboot.dto.ScreenDto;
import com.hzncc.flowable_diboot.service.ScreenDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/screen")
@RequiredArgsConstructor
public class ScreenDataController{

    private final ScreenDataService screenDataService;

    @PostMapping("/winCustomer")
    public JsonResult<Long> winCustomer(@RequestBody ScreenDto dto){
        return JsonResult.OK(screenDataService.getWinCustomer(dto));
    }

    @PostMapping("/customerDistribution")
    public JsonResult<Object> customerDistribution(@RequestBody ScreenDto dto){
        return JsonResult.OK(screenDataService.customerDistribution(dto));
    }

    /**
     * 销售排名
     */
    @PostMapping("/salesRanking")
    public JsonResult<?> salesRanking(@RequestBody ScreenDto dto){
        return JsonResult.OK(screenDataService.salesRanking(dto));
    }
}
